home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of Tucows 3
/
The Best of Tucows 3 - Disc 1.iso
/
content
/
win95
/
files
/
mainst.exe
/
_setup.lib
/
Setup.rul
< prev
next >
Wrap
Text File
|
1997-02-09
|
12KB
|
350 lines
/*----------------------------------------------------------------------------*\
*
* IIIIIII SSSSSS
* II SS InstallShield (R)
* II SSSSSS (c) 1990-1996, Stirling Technologies, Inc.
* II SS All Rights Reserved.
* IIIIIII SSSSSS
*
*
* File Name: SETUP.RUL
*
* Description: InstallShield Professional Edition
* 32-bit script.
*
*
* Author: Diamond Ridge, Inc. Date: 2-8-97
*
* Comments:
*
*
*
\*----------------------------------------------------------------------------*/
declare
// Constant declarations.
#define SPACE_REQUIRED 4500000 // Disk space in bytes.
#define APP_NAME "CRADAbase"
#define PROGRAM_FOLDER_NAME "CRADAbase"
#define APPBASE_PATH "CRADAbase\\"
#define APPBASE_PATH_WIN32S "CRADAbase\\"
#define COMPANY_NAME "Diamond Ridge, Inc."
#define PRODUCT_NAME "CRADAbase"
#define PRODUCT_VERSION "1.0"
#define DEINSTALL_KEY "CRADAbase"
#define UNINSTALL_NAME "CRADAbase"
#define PRODUCT_KEY "tucars.exe"
// Global variable declarations.
STRING svFolder, svDir, szMsg, szFileSet, szTitle, svUninstLogFile;
STRING svTarget, szProgram, szParam, szTemp, szAppPath, svSite, svDUMName;
BOOL bSpaceOk, bWinNT, bWin32s, bIsShellExplorer;
NUMBER nResult;
#include "sddialog.h"
// Function declarations.
prototype SetupScreen();
prototype CheckRequirements();
program
StartHere:
Disable( BACKGROUND );
// Set installation info., which is required for registry entries.
InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY );
// Set up thr installation screen.
SetupScreen();
Enable( DIALOGCACHE );
// Create a Welcome dialog.
WelcomeDlg:
Disable( BACKBUTTON );
Welcome( "", 0 );
Enable( BACKBUTTON );
// Test target system for proper configuration.
CheckRequirements();
// Ask user for a destination location for the installation.--
GetTargetDirectory:
if (bWin32s) then
svTarget = TARGETDISK ^ APPBASE_PATH_WIN32S;
else
svTarget = TARGETDISK ^ APPBASE_PATH;
endif;
if ( AskDestPath( "", szMsg,
svTarget, 0 ) = 12 ) then
goto WelcomeDlg;
endif;
// Perform space check of target drive.
bSpaceOk = TRUE;
if (GetDiskSpace( svTarget ) < SPACE_REQUIRED) then
szMsg = "There is not enough space available on the disk\n" +
"'" + svTarget + "' \n" +
"Please free up some space or change the target location\n" +
"to a different disk";
MessageBox( szMsg, WARNING );
bSpaceOk = FALSE;
endif;
// If not enough space, ask user to try again.
if (bSpaceOk = FALSE) goto GetTargetDirectory;
// Set the App Paths key for the main program.
szAppPath = svTarget ^ "PROGRAM";
RegDBSetItem( REGDB_APPPATH, szAppPath );
szProgram = svTarget ^ "PROGRAM\\tucars.exe";
RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
// Ask user for Site Code for database replication.
GetSite:
SetDialogTitle(DLG_ASK_TEXT, "Enter Site Code");
if (AskText("Please enter the Site Code (used for database replication)","",svSite) = 12) then
goto GetTargetDirectory;
endif;
if (svSite = "") goto GetSite;
SetupFilesToTransfer:
szFileSet = "General";
TARGETDIR = svTarget;
// Define the file set.
FileSetBeginDefine( szFileSet );
SetStatusWindow( -1, "Copying program files..." );
CompressGet( "DATA.Z", "program\\*.*", INCLUDE_SUBDIR );
SetStatusWindow( -1, "Copying TWAIN drivers..." );
TARGETDIR = WINDIR;
CompressGet( "DATA.Z", "twain\\*.*", INCLUDE_SUBDIR );
SetStatusWindow( -1, "Copying system files..." );
TARGETDIR = WINSYSDIR;
CompressGet( "DATA.Z", "winsys\\*.*", INCLUDE_SUBDIR );
FileSetEndDefine( szFileSet );
TransferFiles:
// Prepare InstallShield to record deinstallation information.
DeinstallStart( svTarget, svUninstLogFile, DEINSTALL_KEY, 0 );
RegDBSetItem( REGDB_UNINSTALL_NAME, UNINSTALL_NAME );
// Set up progress indicator and information gauge.
Disable( DIALOGCACHE );
Enable( STATUSDLG );
StatusUpdate( ON, 90 );
// Perform the file set.
SetStatusWindow( 0, "Copying program files..." );
nResult = FileSetPerformEz( szFileSet, 0 );
switch (nResult)
case FS_DONE: // Successful completion.
case FS_CREATEDIR: // Create directory error.
MessageBox( "Unable to create a directory under " + TARGETDIR + "."+
"Please check write access to this directory.", SEVERE );
exit;
default: // Group all other errors under default label.
NumToStr( szTemp, nResult );
MessageBox( "General file transfer error."+
"Please check your target location and try again."+
"\n\n Error Number:"+szTemp +
"\n Related File: "+ERRORFILENAME,
SEVERE );
exit;
endswitch;
Delay( 1 );
// Create app subdirectories
CreateDir(svTarget ^ "Database");
CreateDir(svTarget ^ "Pictures");
CreateDir(svTarget ^ "Reports");
CreateDir(svTarget ^ "Repl");
CreateDir(svTarget ^ "Repl\\Crada");
CreateDir(svTarget ^ "Repl\\" + svSite);
// Modify Autoexec.bat
SetStatusWindow( -1, "Modifying startup files..." );
BatchFileLoad("");
BatchDeleteEx("SQLREMOTE",0);
BatchAdd("SQLREMOTE", svTarget ^ "REPL", "PATH", AFTER);
BatchFileSave("");
// Modify site-specific info in CRADA.INI
LongPathToShortPath(svTarget);
WriteProfString(WINDIR ^ "CRADA.INI", "Account Information", "Site", svSite);
WriteProfString(WINDIR ^ "CRADA.INI", "Directories", "Database", svTarget ^ "Database");
WriteProfString(WINDIR ^ "CRADA.INI", "Directories", "Logo", svTarget ^ "Crada.bmp");
WriteProfString(WINDIR ^ "CRADA.INI", "Directories", "LocalPictures", svTarget ^ "Pictures");
WriteProfString(WINDIR ^ "CRADA.INI", "Directories", "Reports", svTarget ^ "Reports");
WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "TUTransactionDir", "Crada");
WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "DealerTransactionFiles", svSite + "\\*.*");
WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "LocalDealerTransactionDir", svTarget ^ "Repl" ^ svSite);
WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "LocalTUTransactionFiles", svTarget ^ "Repl\\Crada\\*.*");
WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "FtpFromTUScript", "c:\\ftptu.txt");
WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "IP", "ftp.etu.com");
WriteProfString(WINDIR ^ "CRADA.INI", "Replication Settings", "FtpToTUScript", "c:\\ftp2tu.txt");
WriteProfString(WINDIR ^ "CRADA.INI", "TUADS Car Scheduling", "Program", svTarget ^ svDUMName);
// Create program folders and icons.
InstallProgramItems:
SetStatusWindow( 95, "Creating Program Folder and Icons...." );
AppCommand( PROGMAN, CMD_RESTORE );
svFolder = PROGRAM_FOLDER_NAME;
CreateProgramFolder( svFolder );
ShowProgramFolder( svFolder, 0 );
LongPathToShortPath( svTarget );
Delay(1);
szProgram = svTarget ^ "TUCARS.EXE";
AddFolderIcon( svFolder, APP_NAME, szProgram,
svTarget,
"", 0, "", REPLACE );